#!/usr/bin/node

const log=console.log;

log(`dir name: ${__dirname}`);

log(`filer name: ${__filename}`);

//方案一：没有考虑跨平台
let fileName=__dirname+'views/view.html';

//方案二：平台考虑不全面。代码复杂
switch(process.platform){
  case 'linux':
    fileName=__dirname+'/views/view.html';
    break;

  case 'win32':
    fileName=__dirname+'\\views\\view.html';
    break;

  default:
    fileName='something wrong';
}

log(`fileName:${fileName}`);

//方案3：最佳
const path=require('path');
fileName=path.join(__dirname,'views','login.html');
log('fileName:',fileName);
